#ifndef H264_DECODER_H
#define H264_DECODER_H
#include "AV_Common.h"
#include <QThread>

class H264_Decoder : public QThread
{
public:
    H264_Decoder(AVContext* acv,QObject* parent = nullptr);
    ~H264_Decoder();
    int Open(AVCodecParameters* codecParamer);

    inline bool isFull(){return video_queue_.size() > 10;}
    inline void put_packet(const AVPacketPtr packet){video_queue_.push(packet);}
protected:
    void Close();
    virtual void run() override;//线程函数
private:
    bool quit_= false;
    AVCodec* codec_= nullptr;
    AVCodecContext* codecContext_=nullptr;
    AVFramePtr yuv_frame_= nullptr;
    AVQueue<AVPacketPtr>video_queue_;
    AVContext* avContxt_= nullptr;

};

#endif // H264_DECODER_H
